<template>
  <div class="mui-numbox" data-numbox-min="1">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input id="test" class="mui-input-numbox" type="number" value="1" @change="getCount" ref="num">
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>


<script>
import mui from "../../../lib/mui/js/mui.min.js";
export default {
  mounted() {
    mui(".numberbox").numbox();
  },
  methods: {
    getCount() {
      // console.log(this.$refs.num.value);
      // 子组件向父组件传值
      this.$emit("getcount", parseInt(this.$refs.num.value));
    }
  },
  props: ["max"],
  watch: {
    max: function(newVal, oldVal) {
      // console.log(newVal);
      mui(".mui-numbox")
        .numbox()
        .setOption("max", newVal);
    }
  }
};
</script>

<style lang="sass" scoped>

</style>
